#ifndef		_PREDEF_HPP
#define		_PREDEF_HPP


#include "stm8l15x.h"
#include "stm8l15x_it.h"

typedef int (*FunPoint)(void);



struct BYTEBIT {
unsigned b0: 1;
unsigned b1: 1;
unsigned b2: 1;
unsigned b3: 1;
unsigned b4: 1;
unsigned b5: 1;
unsigned b6: 1;
unsigned b7: 1;
};


union  BYTEBITDEF{
	struct BYTEBIT bbyte;
	unsigned char  cbyte;
} ;
 

#define		BIT0		(1<<0)
#define		BIT1		(1<<1)
#define		BIT2		(1<<2)
#define		BIT3		(1<<3)
#define		BIT4		(1<<4)
#define		BIT5		(1<<5)
#define		BIT6		(1<<6)
#define		BIT7		(1<<7)
#define		BIT8		(1<<8)
#define		BIT9		(1<<9)
#define		BIT10		(1<<10)
#define		BIT11		(1<<11)
#define		BIT12		(1<<12)
#define		BIT13		(1<<13)
#define		BIT14		(1<<14)
#define		BIT15		((u32)1<<15)
#define		BIT16		((u32)1<<16)
#define		BIT17		((u32)1<<17)
#define		BIT18		((u32)1<<18)
#define		BIT19		((u32)1<<19)
#define		BIT20		((u32)1<<20)
#define		BIT21		((u32)1<<21)

#define		REV32(A)		((((u32)((A)&0xFF))<<24)|(((u32)((A)&0xFF00))<<8)|(((A)>>8)&0xFF00)|((A)>>24))
#define		REV16(A)		((((A)&0xFF)<<8)|(((A)&0xFF00)>>8))



#define u32p(s) (*((u32*)(s)))
#define u16p(s) (*((u16*)(s)))
#define u8p(s) (*((u8*)(s)))

#define p8(a) ((u8*)(&(a)))

#define uc8  u8
#define vu8  u8
#define vu16 u16
#define vu32 u32
#define uc32 u32

//-------------------------------------

typedef struct
{
	u8 Bit0:1;
	u8 Bit1:1;
	u8 Bit2:1;
	u8 Bit3:1;
	u8 Bit4:1;
	u8 Bit5:1;
	u8 Bit6:1;
	u8 Bit7:1;
}strBit8;

typedef struct
{
	u16 Bit0:1;
	u16 Bit1:1;
	u16 Bit2:1;
	u16 Bit3:1;
	u16 Bit4:1;
	u16 Bit5:1;
	u16 Bit6:1;
	u16 Bit7:1;
	u16 Bit8:1;
	u16 Bit9:1;
	u16 Bit10:1;
	u16 Bit11:1;
	u16 Bit12:1;
	u16 Bit13:1;
	u16 Bit14:1;
	u16 Bit15:1;
}strBit16;


#endif		//_PUB_SET_
